package while循环;

import java.util.Scanner;

/*  //**练习：**从键盘输入整数，输入0结束，统计输入的正数、负数的个数。*/
public class Demo1 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int count1=0;
        int count2=0;
        int num=1;
        while (num!=0){
            System.out.println("请输入一个数（0表示结束）:");
            num=scanner.nextInt();
            if (num>0){
                count1++;
            } else if (num<0) {
                count2++;
            }
        }
        System.out.println("正整数的个数为:"+count1);
        System.out.println("负整数的个数为:"+count2);
    }
}
